#include <cstdlib>
#include <iostream>
#include <stdio.h>

using namespace std;

int main(int argc, char *argv[])
{
    
    /*arg 1 = Project location
     arg2 =  Instrumeted folder
     arg3 =  mainclass
    */
    FILE* ret = fopen("c:\\instrumentation.txt", "w" ) ;
    
     if (argc >= 3) {
             
        char command[1000];
         //Instrument the code.
        strcat(command, "java emma instr -d \"");
        strcat(command, argv[2]);
        strcat(command, "\" -ip \"");
        strcat(command, argv[1]);
        strcat(command, "\" \0");
        printf(command);
        fprintf(ret, "%s \n", command);
        fflush(ret);
       // run the instrumented coverage
        system(command);        
        
    } else {
      return -1;
    }

    return EXIT_SUCCESS;
}
